package guice.boot.archive.container.guice;

import com.google.inject.multibindings.Multibinder;
import guice.boot.archive.common.guice.AbstractModule;
import guice.boot.archive.container.pipeline.StandardPipeline;
import guice.boot.archive.container.service.biz.BizDeployServiceImpl;
import guice.boot.archive.container.service.biz.BizFactoryServiceImpl;
import guice.boot.archive.container.service.biz.BizManagerServiceImpl;
import guice.boot.archive.container.service.classloader.ClassLoaderServiceImpl;
import guice.boot.archive.container.service.event.EventServiceImpl;
import guice.boot.archive.container.service.extension.ExtensionLoaderServiceImpl;
import guice.boot.archive.container.service.injection.InjectionServiceImpl;
import guice.boot.archive.container.service.plugin.PluginDeployServiceImpl;
import guice.boot.archive.container.service.plugin.PluginFactoryServiceImpl;
import guice.boot.archive.container.service.plugin.PluginManagerServiceImpl;
import guice.boot.archive.container.service.registry.RegistryServiceImpl;
import guice.boot.archive.spi.pipeline.Pipeline;
import guice.boot.archive.spi.service.ArchiveService;
import guice.boot.archive.spi.service.biz.BizDeployService;
import guice.boot.archive.spi.service.biz.BizFactoryService;
import guice.boot.archive.spi.service.biz.BizManagerService;
import guice.boot.archive.spi.service.classloader.ClassLoaderService;
import guice.boot.archive.spi.service.event.EventService;
import guice.boot.archive.spi.service.extension.ExtensionLoaderService;
import guice.boot.archive.spi.service.injection.InjectionService;
import guice.boot.archive.spi.service.plugin.PluginDeployService;
import guice.boot.archive.spi.service.plugin.PluginFactoryService;
import guice.boot.archive.spi.service.plugin.PluginManagerService;
import guice.boot.archive.spi.service.registry.RegistryService;


public class Module extends AbstractModule {

    @Override
    protected void configure() {
        binder().bind(Pipeline.class).to(StandardPipeline.class);

        Multibinder<ArchiveService> archiveServiceMultibinder = Multibinder.newSetBinder(binder(), ArchiveService.class);
        archiveServiceMultibinder.addBinding().to(PluginDeployServiceImpl.class);
        archiveServiceMultibinder.addBinding().to(BizDeployServiceImpl.class);
        archiveServiceMultibinder.addBinding().to(ClassLoaderServiceImpl.class);
        //arkServiceMultibinder.addBinding().to(StandardTelnetServerImpl.class);

        binder().bind(PluginManagerService.class).to(PluginManagerServiceImpl.class);
        binder().bind(BizManagerService.class).to(BizManagerServiceImpl.class);
        binder().bind(ClassLoaderService.class).to(ClassLoaderServiceImpl.class);
        binder().bind(PluginDeployService.class).to(PluginDeployServiceImpl.class);
        binder().bind(BizDeployService.class).to(BizDeployServiceImpl.class);
        binder().bind(RegistryService.class).to(RegistryServiceImpl.class);
        binder().bind(InjectionService.class).to(InjectionServiceImpl.class);
        //binder().bind(TelnetServerService.class).to(StandardTelnetServerImpl.class);
        binder().bind(BizFactoryService.class).to(BizFactoryServiceImpl.class);
        binder().bind(PluginFactoryService.class).to(PluginFactoryServiceImpl.class);
        binder().bind(ExtensionLoaderService.class).to(ExtensionLoaderServiceImpl.class);
        binder().bind(EventService.class).to(EventServiceImpl.class);
    }
}